package main

import "fmt"

// LinkedList 泛型结构体实现
// 该结构体实现了泛型接口List[T any]
type LinkedList[T any] struct {
	//链表头结点
	head *node[T]
}

func (l *LinkedList[T]) Add(index int, value T) {
	//TODO impl
	fmt.Printf("LinkedList#Add(index=%d, value=%v)\n", index, value)
}

func (l *LinkedList[T]) Append(value T) {
	//TODO impl
	fmt.Printf("LinkedList#Append(value=%v)\n", value)
}

func (l *LinkedList[T]) Delete(index int) {
	//TODO impl
	fmt.Printf("LinkedList#Delete(index=%dv)\n", index)
}

// 链表节点
type node[T any] struct {
	//当前节点值
	value T

	//前继节点指针
	prev *node[T]

	//后继节点指针
	next *node[T]
}
